import {
  IsNotEmpty,
  IsString,
  IsInt,
  IsDate,
  IsEmail,
  IsNumber,
  IsOptional,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateUserDto {
  @ApiPropertyOptional({ description: '用户 ID', example: 1 })
  @IsOptional()
  @IsNumber()
  id: number;

  @ApiProperty({ description: '用户姓名', example: '张三' })
  @IsNotEmpty()
  @IsString()
  name: string;

  @ApiPropertyOptional({ description: '用户电话', example: '13800138000' })
  @IsString()
  phone?: string;

  @ApiPropertyOptional({ description: '用户邮箱', example: 'user@example.com' })
  @IsEmail()
  email?: string;

  @ApiPropertyOptional({
    description: '用户身份证号',
    example: '110101199003072312',
  })
  @IsString()
  idCard?: string;

  @ApiPropertyOptional({ description: '用户年龄', example: 25 })
  @IsInt()
  age?: number;

  @ApiProperty({ description: '用户密码', example: '123456' })
  @IsString()
  password: string;

  @ApiProperty({ description: '用户名', example: 'zhangsan' })
  @IsString()
  username: string;

  @ApiPropertyOptional({ description: '用户性别', example: 'male' })
  @IsString()
  gender?: string;

  @ApiPropertyOptional({ description: '用户地址', example: '北京市朝阳区' })
  @IsString()
  address?: string;

  @ApiProperty({ description: '创建人 ID', example: 1 })
  @IsInt()
  createBy: number;

  @ApiProperty({ description: '创建时间', example: '2025-05-31T00:00:00.000Z' })
  @IsDate()
  createTime: Date;

  @ApiProperty({ description: '更新人 ID', example: 1 })
  @IsInt()
  updateBy: number;

  @ApiProperty({ description: '更新时间', example: '2025-05-31T00:00:00.000Z' })
  @IsDate()
  updateTime: Date;
}
